package com.hmall.api.client.fallback;


import com.hmall.api.client.CartClient;
import com.hmall.common.exception.BizIllegalException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * 购物车服务降级处理
 */
@Slf4j
public class CartClientFallback implements FallbackFactory<CartClient> {

    @Override
    public CartClient create(Throwable cause) {
        return itemIds -> {
            log.error("【购物车服务】远程调用CartClient#deleteCartItemByIds方法出现异常", cause);
            throw new BizIllegalException(cause);
        };
    }
}
